package com.xpffly.design.factory.common;

import com.xpffly.design.factory.common.factory.ConcreteProductObjCreator;
import com.xpffly.design.factory.common.factory.ProductObjCreator;
import com.xpffly.design.factory.common.service.Product;
import com.xpffly.design.factory.common.service.impl.ConcreteProduct1;
import com.xpffly.design.factory.common.service.impl.ConcreteProduct2;

/**
 * @Author: xpengfei
 * @Date: 2021/3/26 23:51
 * @Description：场景类
 */
public class Scene {
    public static void main(String[] args) {
        // 定义工厂类
        ProductObjCreator productObjCreator = new ConcreteProductObjCreator();
        // 具体产品类1
        Product product1 = productObjCreator.createProduct(ConcreteProduct1.class);
        product1.method1();
        product1.method2();
        System.out.println("-----------------------------------------");
        //具体产品类2
        Product product2 = productObjCreator.createProduct(ConcreteProduct2.class);
        product2.method1();
        product2.method2();
    }
}
